<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('货主管理')"/>

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-form-label">货主名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="mc" name="mc" placeholder="货主名称"/>
                        </div>
                    </div>
                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal" data-type="reload">查询</a>
                    </div>
                    <div class="layui-inline inline-reset-btn">
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </form>
                <!--顶部按钮展示区域 【 tpl-button 】 -->
                <div class="group-button tpl-button" id="toolbar"></div>
                <!--列表-->
                <section class="panel panel-padding layui-card-body">
                    <div class="pro">
                        <table id="table" class="table text-nowrap"></table>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>

</body>
<div th:include="public/public_js::public_js"></div>
<div th:include="public/public_btn::public_btn"></div>
<style type="text/css">
    .moreBtn {
        width: 50px;
        height: 20px;
        text-align: center;
        color: #fff;
        line-height: 20px;
        background-color: #eee;
        position: relative;
        margin: 0 auto;
        cursor: pointer;
    }

    .moreBtn:before {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(30deg);
        background: #eee;
        border-top-left-radius: 8px;
        left: -20px;
        top: 0;
    }

    .moreBtn:after {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(-30deg);
        background: #eee;
        border-top-right-radius: 8px;
        top: 0;
        right: -20px;
    }
</style>
<script th:inline="javascript">
    var functions = [[${functions}]];
    //	回车查询
    document.onkeydown = function(event) {
        e = event ? event : (window.event ? window.event : null);
        if (e.keyCode == 13) {
            //执行的方法
            $('#search_button').click();
        }
    };
    layui.use(['list', 'layer', 'zzpUtils', 'jquery', 'laydate','tablebutton'], function () {
        var zzpUtils = layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate,
            tablebtn = layui.tablebutton;
        var $table;
        tablebtn.buildOnClick({
            type: 1,
            temp: $("#function_tpl"),
            functions: functions.headBtn,
            row: null,
            event: {
                searchEvent: function(){
                    zzpUtils.refreshTable("#table");
                },
                //新增
                addEvent: function (data) {
                    add();
                },
                /*编辑*/
                editEvent: function (data) {
                    if (data.row != undefined) {
                        upDialog(data);
                    }
                },
                //配置订单
                peizhiOrderEvent: function (data) {
                    if (data.row != undefined) {
                        peizhiOrderDialog(data);
                    }
                },
                //暂存集货
                zjKwEvent: function (data) {
                    if (data.row != undefined) {
                        zjKwDialog(data);
                    }
                },
                /*编辑库位*/
                editLocation: function (data) {
                        EditLocation(data);
                },
            }
        });
        //初始化
        zzpUtils.webSocket.init();
        //新增
        function add() {
            zzpUtils.dialog({
                title: "新增货主",
                type: 2,
                content: "/ownerRouter/toAddowner",
                area: ['80%', '90%'], //设置dialog大小，也可以不设置，
                end: function () {//增加成功后刷新
                    zzpUtils.refreshTable("#table");
                }

            });
        }

        //编辑货主
        function upDialog(data) {
            var id=data.row.id;
            zzpUtils.dialog({
                title: "编辑货主",
                type: 2,
                content: "/ownerRouter/toEditOwner?id=" + id,
                area: ['80%', '80%'], //设置dialog大小，也可以不设置，
                end: function () {//修改成功后刷新
                    zzpUtils.refreshTable("#table");
                }
            });
        }
        //编辑库位
        function EditLocation(data) {
//            alert(111);
            var id=data.row.id;
            zzpUtils.dialog({
                title: "编辑库位",
                type: 2,
                content: "/ownerRouter/toEditLocation?id=" + id,
                area: ['98%', '98%'], //设置dialog大小，也可以不设置，
                end: function () {//修改成功后刷新
                    zzpUtils.refreshTable("#table");
                }
            });
        }
        //配置订单
        function peizhiOrderDialog(data) {
            var id=data.row.id;
            var mc=data.row.mc;
            zzpUtils.dialog({
                title: false,
                type: 2,
                content: "/ownerRouter/toPeizhiOwner?id=" + id+"&mc="+mc,
                area: ['80%', '80%'], //设置dialog大小，也可以不设置，
                end: function () {//修改成功后刷新
                    zzpUtils.refreshTable("#table");
                }
            });
        }
        //跳 配置集货库位和暂存库位页面
        function zjKwDialog(data) {
            var id=data.row.id;
            var mc=data.row.mc;
            zzpUtils.dialog({
                title: false,
                type: 2,
                content: "/ownerRouter/toGetAllKw?id="+ id+"&mc="+mc,
                area: ['60%', '60%'], //设置dialog大小，也可以不设置，
                end: function () {//修改成功后刷新
                    zzpUtils.refreshTable("#table");
                }
            });
        }
        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination: true,
            isOperate: true,
            functions: functions.tableBtn,
            url: '/wmsOwner/list',
            columns: [
             {
                field: 'mc',
                title: '货主名称'
            }, {
                field: 'lxr',
                title: '联系人'
            },  {
                field: 'dz',
                title: '地址'
            },  {
                field: 'show_sjgzid',
                title: '上架规则',
                visible:false
            },  {
                field: 'show_dcfh',
                title: '多次发货',
                visible:false
            },{
                field: 'show_slbuck',
                title: '出库规则',
                visible:false
            },  {
                field: 'show_zyzdqr',
                title: '库内转移',
                visible:false
            },  {
                field: 'show_bhzdqr',
                title: '补货单',
                visible:false
            },  {
                field: 'ddsxts',
                title: '失效天数',
                visible:false
            },  {
                field: 'show_shscpch',
                title: '批次号',
                visible:false
            },  {
                field: 'show_shfk',
                title: '收货反馈',
                visible:false
            },  {
                field: 'show_zxqx',
                title: '是否装箱',
                visible:false
            },  {
                field: 'show_shscscrq',
                title: '生产日期',
                visible:false
            },  {
                field: 'show_kcyj',
                title: '库存预警',
                visible:false
            },  {
                field: 'show_pdwwcqx',
                title: '完成盘点',
                visible:false
            },  {
                field: 'show_djpda',
                title: 'PDA',
                visible:false
            },  {
                field: 'show_djdps',
                title: 'DPS',
                visible:false
            },  {
                field: 'show_ckfh',
                title: '出库复核',
                visible:false
            },  {
                field: 'show_cz',
                title: '称重',
                visible:false
            },  {
                field: 'show_fhdymd',
                title: '快递面单',
                visible:false
            },  {
                field: 'show_zcd',
                title: '装车单',
                visible:false
            },  {
                field: 'show_cmhpm',
                title: '扫描货品码',
                visible:false
            },  {
                field: 'show_shscpch',
                title: '扫描LPN',
                visible:false
            }],
            queryParams: function () {//查询条件
                return  zzpUtils.getFormJson($("#searchForm"));
            },
            detailFormatter: function (index, row) {
                return "这里就没有确定过11";
            },
            /*定义表格右侧按钮*/
            operateFormatter: operateFormatter
        });
        $(".inline-search-btn").on('click',function () {
            zzpUtils.refreshTable("#table");
        })

        /*表格右侧按钮*/
        function operateFormatter(value, row, index) {
            var btn = '', button = '', buttons1 = '', buttons2 = '';
            for (var i = 0; i < functions.tableBtn.length; i++) {
                var item = functions.tableBtn[i];
                //更多之外
                buttons1 += '<button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="' + item.event + '">'
                    + item.name
                    + '</button>';
            }

            return buttons1;
        }
        /*表格右侧按钮*/
       /* function operateFormatter(value, row, index) {
            var button = '<a class="tooltip2" id="tooltip' + row.id + '" data-tooltip-content="#tool' + row.id + '" id="btn_start"><i class="layui-icon layui-icon-more"></i></a>'
                + '<div class="tooltip_templates">'
                + '<span id="tool' + row.id + '">';
            for (var i = 0; i < functions.tableBtn.length; i++) {
                var btn = '<a class="layui-btn layui-btn-sm layui-btn-warm" lay-event="' + functions.tableBtn[i].event + '">'
                    + functions.tableBtn[i].name
                    + '</a>';
                button += btn;

            }
            button += '</span>'
                + '</div>';
            return button;
        }*/

    });




</script>
</html>